package com.woniuxy.stage3demo.service.lyl.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;


import com.woniuxy.stage3demo.bean.lyl.StationMessageBean;
import com.woniuxy.stage3demo.mapper.lyl.StationMessageMapper;
import com.woniuxy.stage3demo.pageHelper.PageRequest;
import com.woniuxy.stage3demo.service.lyl.IStationMsgService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Transactional(readOnly = false)
@Service
public class StationMsgServiceImpl implements IStationMsgService {
@Resource
private StationMessageMapper stationMessageMapper;
//分页查询
    @Override
    public PageInfo<StationMessageBean> findAllByParams(PageRequest request,StationMessageBean stationMessageBean) {
        return PageHelper.startPage(request.getPageNum(),request.getLimit()).
                doSelectPageInfo(()-> stationMessageMapper.findAllByParams(request,stationMessageBean));
    }
//存储新站内信
    @Override
    public void saveStationMessageBean(StationMessageBean stationMessageBean) {
    stationMessageMapper.saveStationMessageBean(stationMessageBean);
    }
//删除一条站内信
    @Override
    public void deleteOneStationMessageBean(Long id) {
        stationMessageMapper.deleteOneStationMessageBean(id);
    }
//查询站内信
   /* @Override
    public PageInfo<StationMessageBean> selectStationMessageBeanByTitleAndName(PageRequest request, String stationMsgTitle, String name) {
        *//*return stationMessageMapper.selectStationMessageBeanByTitleAndName(request,stationMsgTitle,name);*//*
        return PageHelper.startPage(request.getPageNum(),request.getLimit()).
                doSelectPageInfo(()-> stationMessageMapper.selectStationMessageBeanByTitleAndName(request,stationMsgTitle,name));
    }*/

}
